import request from '@/utils/request'

//获取id 商品信息
export function getGoodInfo(id){
    return request({
        url:'/api/getGoodInfo',
        params:{id}
    })
}

//获取首页商品列表
export function getHomeGoodList(page,pageSize){
  return request({
    url:'/api/getGoods',
    params:{page,pageSize}
  })
}

//获取后台商品列表
export function getAdminGoodList(page,pageSize){
  return request({
    url:'/api/getAdminGoods',
    params:{page,pageSize}
  })
}

//查询订单
export function getOrderInfo(phone,idCard){
  return request({
    url:'/api/searchOrder',
    params:{phone,idCard}
  })
}

//查询订单列表
export function getOrdersList(page,pageSize){
  return request({
    url:'/api/getOrdersList',
    params:{page,pageSize}
  })
}

//条件搜索订单
export function searchOrderByAdmin(params){
  return request({
    url:'/api/searchOrderByAdmin',
    params
  })
}

//后台登录
export function adminLogin(username,password){
  return request({
    url:'/api/login',
    method:'POST',
    data:{
      username,
      password
    }
  })
}

//新增产品
export function saveGood(data){
  return request({
    url:'/api/saveGood',
    method:'PUT',
    data
  })
}

//删除产品
export function deleteById(id){
  return request({
    url:'/api/delete/'+id,
    method:'DELETE'
  })
}

//上/下架
export function editByStatus(id){
  return request({
    url:'/api/edit/'+id,
    method:'PUT',
  })
}

//修改物流单号
export function editCourier(id,courier){
  return request({
    url:'/api/editCourier',
    method:'PUT',
    params:{
      id,
      courier
    }
  })
}

//删除订单号
export function deleteByID(id){
  return request({
    url:'/api/order/'+id,
    method:'DELETE'
  })
}

//批量上传图片并转GIF
export function uploadBatch(formData,delay,repeat){
  return request({
    url:'/api/uploadBath',
    method:'POST',
    params:{delay,repeat},
    data: formData
  })
}